<template>
  <div class="my">
    <!-- 头部部分 -->
    <div class="top">
      <div class="top-c" @click="$router.push('/home/myInfo')">
        <div class="left">
          <div class="top-title">{{ userInfo.nickname }}</div>
          <div class="top-text">{{ userInfo.intro }}</div>
        </div>
        <img
          v-if="userInfo.avatar"
          :src="baseUrl + userInfo.avatar"
          alt=""
          class="right"
        />
        <img src="@/assets/logo.png" alt="" class="right" v-else />
      </div>
      <ul class="top-center">
        <li class="top-itme">
          <div class="num">298</div>
          <div class="info">累积大图</div>
        </li>
        <li class="top-itme">
          <div class="num">98</div>
          <div class="info">收藏题目</div>
        </li>
        <li class="top-itme">
          <div class="num">198</div>
          <div class="info">我的错题</div>
        </li>
        <li class="top-itme">
          <div class="num">76%</div>
          <div class="info">正确率</div>
        </li>
      </ul>
      <div class="position">
        <!-- <van-cell class="cell" center is-link>
          <template #icon>
            <i class="iconfont">&#xe64d;</i>
          </template>
          <template #title>
            <div class="work">我的岗位</div>
          </template>
          <template #default>
            <div class="value">产品经理</div>
          </template>
        </van-cell> -->
        <!-- 使用组件 -->
        <my-cell
          icon="&#xe64d;"
          title="我的岗位"
          :value="userInfo.position"
          @click.native="$router.push('/home/editInfo?type=position')"
        ></my-cell>
      </div>
    </div>
    <!-- 中间部分 -->
    <div class="content">
      <div class="middle">
        <h3 class="middle-title">面经数据</h3>
        <ul class="middle-num">
          <li class="midele-item">
            <p class="tiem">昨日阅读<span class="color">+300</span></p>
            <p class="num">17</p>
            <p class="text">阅读总数</p>
          </li>
          <li class="midele-item">
            <p class="tiem">昨日获赞<span class="color">+300</span></p>
            <p class="num">17</p>
            <p class="text">获赞总数</p>
          </li>
          <li class="midele-item">
            <p class="tiem">昨日新增<span class="color">+12</span></p>
            <p class="num">17</p>
            <p class="text">评论总数</p>
          </li>
        </ul>
      </div>
    </div>
    <!-- 底部 -->
    <div class="botton">
      <div class="botton-s">
        <!-- <van-cell class="cell" center is-link>
          <template #icon>
            <i class="iconfont">&#xe655;</i>
          </template>
          <template #title>
            <div class="work">我的面经分享</div>
          </template>
          <template #default>
            <div class="value">21</div>
          </template>
        </van-cell>
        <van-cell class="cell" center is-link>
          <template #icon>
            <i class="iconfont">&#xe656; </i>
          </template>
          <template #title>
            <div class="work">我的信息</div>
          </template>
          <template #default>
            <div class="value">98</div>
          </template>
        </van-cell>
        <van-cell class="cell" center is-link>
          <template #icon>
            <i class="iconfont">&#xe654;</i>
          </template>
          <template #title>
            <div class="work">收藏的题库</div>
          </template>
          <template #default>
            <div class="value">32</div>
          </template>
        </van-cell>
        <van-cell class="cell" center is-link>
          <template #icon>
            <i class="iconfont">&#xe648;</i>
          </template>
          <template #title>
            <div class="work">收藏的企业</div>
          </template>
          <template #default>
            <div class="value">32</div>
          </template>
        </van-cell>
        <van-cell class="cell" center is-link>
          <template #icon>
            <i class="iconfont">&#xe64f;</i>
          </template>
          <template #title>
            <div class="work">我的错题</div>
          </template>
          <template #default>
            <div class="value">123</div>
          </template>
        </van-cell>
        <van-cell class="cell" center is-link>
          <template #icon>
            <i class="iconfont">&#xe649; </i>
          </template>
          <template #title>
            <div class="work">收藏的面试经验</div>
          </template>
          <template #default>
            <div class="value">166</div>
          </template>
        </van-cell> -->
        <my-cell icon="&#xe655;" title="我的面经分享" value="21"></my-cell>
        <my-cell icon="&#xe656;" title="我的消息" value="98"></my-cell>
        <my-cell icon="&#xe654;;" title="收藏的题库" value="32"></my-cell>
        <my-cell icon="&#xe648;" title="收藏的企业" value="32"></my-cell>
        <my-cell icon="&#xe64f;" title="我的错题" value="123"></my-cell>
        <my-cell icon="&#xe649;" title="收藏的面试经验" value="166"></my-cell>
      </div>
    </div>
  </div>
</template>
<script>
import { mapState } from 'vuex'
// 导入组件
import myCell from './myCell'
export default {
  name: 'my',
  // 注册
  components: {
    myCell
  },
  data () {
    return {
      baseUrl: process.env.VUE_APP_URL
    }
  },
  computed: {
    ...mapState(['userInfo', 'isLogin'])
  },
  mounted () {
    console.log('mapState', mapState(['userInfo', 'isLogin']))
  }
}
</script>
<style lang="less" scoped>
.my {
  .top {
    padding: 75px @p15;
    background: linear-gradient(45deg, #ce0031, #b8002c);
    position: relative;
    .top-center {
      display: flex;
      justify-content: space-between;
      align-items: center;
      text-align: center;
      .num {
        font-size: 21px;
        font-family: DINAlternate, DINAlternate-Bold;
        font-weight: 700;
        text-align: center;
        color: #ffffff;
        line-height: 24px;
        letter-spacing: 0px;
      }
      .info {
        opacity: 0.7;
        font-size: 12px;
        font-family: PingFangSC, PingFangSC-Regular;
        font-weight: 400;
        text-align: center;
        color: #ffffff;
        line-height: 17px;
        letter-spacing: 0px;
        margin-top: 6px;
      }
    }
    .top-c {
      display: flex;
      justify-content: space-between;

      .left {
        .top-title {
          font-size: 21px;
          font-family: PingFangSC, PingFangSC-Semibold;
          font-weight: 600;
          text-align: left;
          color: #ffffff;
          line-height: 30px;
          letter-spacing: 0px;
        }
        .top-text {
          opacity: 0.7;
          font-size: 12px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: left;
          color: #ffffff;
          line-height: 17px;
          letter-spacing: 0px;
          margin-top: 6px;
          margin-bottom: 31px;
        }
      }
      .right {
        width: 50px;
        height: 50px;
        border: 3px solid rgba(255, 255, 255, 0.38);
        border-radius: 50%;
      }
    }
    .position {
      width: 100%;
      position: absolute;
      left: 0;
      bottom: -16px;
      padding: 0 @p15;

      // .cell {
      //   border-radius: 8px;
      //   .iconfont {
      //     font-size: 16px;
      //     padding-right: 17px;
      //   }
      //   .work {
      //     font-size: 14px;
      //     font-family: PingFangSC, PingFangSC-Regular;
      //     font-weight: 400;
      //     text-align: left;
      //     color: #181a39;
      //     line-height: 20px;
      //     letter-spacing: 0px;
      //   }
      // }
    }
  }
  .content {
    background-color: #f7f4f5;
    padding: 24px @p15 10px;

    .middle {
      background-color: #fff;

      border-radius: 8px;
      h3 {
        font-size: 14px;
        font-family: PingFangSC, PingFangSC-Semibold;
        font-weight: 600;
        padding-left: @p15;
        color: #181a39;
        line-height: 20px;
        letter-spacing: 0px;
        padding-top: 19px;
      }
      .middle-num {
        display: flex;
        justify-content: space-around;
        text-align: center;
        padding-bottom: 16px;
        .tiem {
          font-size: 10px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: center;
          color: #b4b4bd;
          line-height: 14px;
          letter-spacing: 0px;
          margin-top: 20px;
          .color {
            color: #04b9d5;
          }
        }
        .num {
          font-size: 21px;
          font-family: DINAlternate, DINAlternate-Bold;
          font-weight: 700;
          text-align: center;
          color: #181a39;
          line-height: 24px;
          letter-spacing: 0px;
          margin: 10px 0;
        }
        .text {
          font-size: 12px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: center;
          color: #545671;
          line-height: 17px;
          letter-spacing: 0px;
        }
      }
    }
  }
  .botton {
    padding: 0 @p15;
    background-color: #f7f4f5;
  }
}
</style>
